package appConfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}

type appConfig struct {
	Mysql Mysql
	Redis Redis
}

var Config appConfig

func Init() {
	var err error

	viper.SetConfigFile("appConfig/dev.yaml")

	err = viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	viper.Unmarshal(&Config)
	fmt.Println("文件配置读取成功")

}
